package com.tengju.support.domain.model.message;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum MessageContentType {

    TEXT(1,"文本"),
    GRAPHIC(2,"图文"),
    PICTURE(3,"纯图"),
    ;

    private Integer val;
    private String desc;

    @JsonValue
    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    @JsonCreator
    public static MessageContentType fromVal(Integer val) {
        for (MessageContentType type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }
}
